Skip to content

Shrink unsafe block #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2023
Merged

Shrink unsafe block #305

merged 1 commit into from
Apr 27, 2023

Conversation

cactter
Copy link
Contributor

@cactter cactter commented Jul 22, 2022

In this function you use the unsafe keyword for almost the entrie function body.

We need to mark unsafe operations more precisely using unsafe keyword. Keeping unsafe blocks small can bring many benefits. For example, when mistakes happen, we can locate any errors related to memory safety within an unsafe block. This is the balance between Safe and Unsafe Rust. The separation is designed to make using Safe Rust as ergonomic as possible, but requires extra effort and care when writing Unsafe Rust.

Hope this PR can help you.
Best regards.
References
https://doc.rust-lang.org/nomicon/safe-unsafe-meaning.html
https://doc.rust-lang.org/book/ch19-01-unsafe-rust.html

@emilio
Copy link
Member

emilio commented Apr 27, 2023

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit d23eb49 has been approved by emilio

@bors-servo
Copy link
Contributor

⌛ Testing commit d23eb49 with merge 9ea6150...

@bors-servo
Copy link
Contributor

☀️ Test successful - checks-github
Approved by: emilio
Pushing 9ea6150 to master...

@bors-servo bors-servo merged commit 9ea6150 into servo:master Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants